
<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="供货商操作">
	<#if (supplier.id)??>
		<#assign isEdit = true />
	<#else>
		<#assign isAdd = true />
	</#if>
	<body class="input">
	<script type="text/javascript">
	$().ready( function() {
	
		var $validateErrorContainer = $("#validateErrorContainer");
		var $validateErrorLabelContainer = $("#validateErrorContainer ul");
		var $validateForm = $("#validateForm");
		var $tab = $("#tab");        
		// Tab效果
		$tab.tabs(".tabContent", {
			tabs: "input"
		});
		
		// 表单验证
		$validateForm.validate({
			errorContainer: $validateErrorContainer,
			errorLabelContainer: $validateErrorLabelContainer,
			wrapper: "li",
			errorClass: "validateError",
			ignoreTitle: true,
			rules: {
					"supplier.name": {
						required: true,
						maxlength: 200
					},
				    "supplier.endTime": {
                    compareDate: "#startTime"
                },
					"supplier.comment": {
						maxlength: 400
					}
			},
			messages: {
					"supplier.name": {
						required: "供货商名称",
						maxlength: "供货商名称长度不能大于200"
					},					
				"supplier.endTime":{
                    compareDate: "到期时间必须大于开始时间!"
                },	
					"supplier.comment": {
						maxlength: "介绍不能大于400"
					}
			},
			submitHandler: function(form) {
				$(form).find(":submit").attr("disabled", true);
				form.submit();
			}
		});
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if> 
	});
	</script>
		<div class="body">
			<div class="inputBar">
				<h1><span class="icon">&nbsp;</span><#if isAdd??>添加供应商<#else>编辑供应商</#if></h1>
			</div>
			<div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
				<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
				<ul></ul>
			</div>			
			<form id="validateForm" class="validate" method="post" action="<#if isAdd??>${web_base}/recharge/supplier!addSupplier.htm<#else>${web_base}/recharge/supplier!editSupplier.htm</#if>">
			<table class="inputTable tabContent">
			<tr>
				<th>供应商名称:<input type="hidden" name="supplier.id" value="<#if isEdit??>${(supplier.id)!}</#if>" ></th>
				<td><input type="text" name="supplier.name" value="${(supplier.name)!}" ><label class="requireField">*</label></td>
			</tr>
			<tr>
				<th>对应渠道接口:</th>
				<td><#if isAdd??><input type="text" name="supplier.interfaceName" class="formText {required: true,remote:'supplier!checkName.htm', minlength: 2, maxlength: 200, messages: {required: '请输入渠道接口!',remote: '渠道接口已经存在!'}}" 
				    value=""><label class="requireField">*</label><#else>${(supplier.interfaceName)!}<input type="hidden" name="supplier.interfaceName" 
				    value="${(supplier.interfaceName)!}" /></#if></td>				    
			</tr>
			<tr>
				<th>介绍:</th>
				<td><textarea class="formText" name="supplier.comment">${(supplier.comment)!}</textarea></td>
			</tr>
			<tr>
				<th>开始时间:</th>
				<td><input type="text"  id="startTime" name="supplier.startTime" <#if isEdit??><#if supplier.startTime?exists&&supplier.startTime?is_date>
				value="${supplier.startTime?string("yyyy-MM-dd")}" </#if></#if> onclick="WdatePicker({readOnly:true})" class="Wdate"></td>
			</tr>
			<tr>
				<th>到期时间:</th>
				<td><input type="text" id="endTime" name="supplier.endTime" <#if isEdit??><#if supplier.endTime?exists&&supplier.endTime?is_date>
				value="${supplier.endTime?string("yyyy-MM-dd")}" </#if></#if> onclick="WdatePicker({readOnly:true})" class="Wdate"></td>
			</tr>
			<tr>
				<th>是否启用:</th>
				<td><select name="supplier.enable">
				    <option value="false" <#if isEdit??><#if supplier.enable?string('true','false')=="false">selected="selected"</#if></#if> >否</option>
					<option value="true"  <#if isEdit??><#if supplier.enable?string('true','false')=="true">selected="selected"</#if></#if> >是</option>
				    </select>
				</td>
			</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="<#if isAdd??>添加<#else>修改</#if>" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
			</form>
		</div>
	</body>

</@edit>